package leetcode;

import java.util.Arrays;

/**
 * 描述:
 *
 * @author Madison You
 * @created 3:35
 */
public class Easy_283_MoveZeroes {

    public static void main(String[] args) {
        int[] ints = {0, 1, 0, 3, 12};
        new Easy_283_MoveZeroes().moveZeroes(ints);
    }

    public void moveZeroes(int[] nums) {
        int index = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != 0) {
                nums[index++] = nums[i];
            }
        }
        for (int i = index; i < nums.length; i++) {
            nums[i] = 0;
        }
    }

}
